package com.nft.utils.radom;

import java.util.Random;

public class RadomUtil {

    /**
     * 随机产⽣⼀个首位不为0的8位随机数的字符串
     */
    public static String getRandomPwd(Integer count) {
        Random rd = new Random();
        StringBuilder n= new StringBuilder();
        int getNum;
        for (int i = 0; i < count;){
            getNum = rd.nextInt(10);// 产⽣数字0-9的随机数
            String num = Integer.toString(getNum);
            //保证第一个数字大于零
            if (n.length() == 0){
                if (getNum>0){
                    n.append(num);
                    i++;
                }
            }else {
                n.append(num);
                i++;
            }
        }
        return n.toString();
    }
}
